/*
 * @Description:
 * @Author: qingyang
 * @Date: 2023-06-20 15:34:46
 * @LastEditors: qingyang
 * @LastEditTime: 2023-07-19 10:26:21
 */
import type { RouteRecordRaw } from 'vue-router'

const loadComponent = (name: string) => {
  return () => import(/* webpackChunkName: "system" */ `@/views/system/${name}/index.vue`)
}

export const routes: Array<RouteRecordRaw> = [
  //配置管理
  {
    path: 'system/configManagement/emission',
    component: loadComponent('configManagement/emission'),
    name: 'Emission',
    meta: {
      title: '排放源配置',
      activeMenu: '/system',
      selectKeysPath: '/system/configManagement/relationshipManagement',
      breadcrumb: [
        {
          name: '关联关系列表',
          path: '/system/configManagement/relationshipManagement'
        },
        {
          name: '排放源配置',
          path: false
        }
      ]
    }
  },
  {
    path: 'system/configManagement/fuelsEnergyMaterials',
    component: loadComponent('configManagement/fuelsEnergyMaterials'),
    name: 'FuelsEnergyMaterials',
    meta: {
      title: '能源/燃料配置',
      activeMenu: '/system',
      selectKeysPath: '/system/configManagement/relationshipManagement',
      breadcrumb: [
        {
          name: '关联关系列表',
          path: '/system/configManagement/relationshipManagement'
        },
        {
          name: '能源/燃料配置',
          path: false
        }
      ]
    }
  },
  {
    path: 'system/configManagement/gwp',
    component: loadComponent('configManagement/gwp'),
    name: 'Gwp',
    meta: {
      selectKeysPath: '/system/factorManagement/inventory',
      title: 'GWP管理',
      activeMenu: '/system',
      breadcrumb: [
        {
          name: '碳盘查因子库',
          path: '/system/factorManagement/inventory'
        },
        {
          name: 'GWP管理',
          path: false
        }
      ]
    }
  },
  {
    path: 'system/configManagement/relationshipManagement',
    component: loadComponent(`configManagement/relationshipManagement`),
    name: 'RelationshipManagement',
    meta: {
      title: '关联关系管理',
      bgColor: '#ffffff',
      activeMenu: '/system'
    }
  },
  {
    path: '/configMangement/factorMatchingRule',
    component: loadComponent(`configManagement/factorMatchingRule`),
    name: 'FactorMatchingRule',
    meta: {
      title: '足迹因子匹配',
      bgColor: '#EDF2F5',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/configManagement/lowCarbonMaterialList',
    component: loadComponent('configManagement/lowCarbonMaterialList'),
    name: 'LowCarbonMaterialList',
    meta: {
      title: '低碳材料库',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/configManagement/factoryWorkshopMeterSet',
    component: loadComponent('configManagement/factoryWorkshopMeterSet'),
    name: 'FactoryWorkshopMeterSet',
    meta: {
      title: '工厂/仪表管理',
      activeMenu: '/system'
    }
  },
  // 产品bom集
  {
    path: 'system/bom/productBomCollect',
    component: loadComponent(`configManagement/productBomCollect`),
    name: 'ProductBomCollect',
    meta: {
      title: '乘用车BOM',
      activeMenu: '/system'
    }
  },
  // 乘用车BOM ->零部件
  {
    path: 'system/bom/productBomCollect/productItem',
    component: loadComponent('configManagement/productBomCollect/productItem'),
    name: 'ProductItem',
    meta: {
      title: '整车-零部件',
      selectKeysPath: '/system/bom/productBomCollect',
      bgColor: '#f3f7fb',
      breadcrumb: [
        {
          name: '乘用车BOM',
          path: '/system/bom/productBomCollect'
        },
        {
          name: '整车-零部件',
          path: false
        }
      ],
      activeMenu: '/system'
    }
  },
  // 因子库查询
  {
    path: 'system/factorManagement/inventory',
    component: loadComponent('factorManagement/inventory'),
    name: 'FactorInventory',
    meta: {
      title: '碳盘查因子库',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/factorManagement/footprint',
    component: loadComponent('factorManagement/footprint'),
    name: 'FactorFootprint',
    meta: {
      title: '碳足迹因子库',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/organizationUser/user',
    component: loadComponent('organizationUser/user'),
    name: 'SystemUserList',
    meta: {
      title: '用户管理',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/organizationUser/organizationManagement',
    component: loadComponent(`organizationUser/organizationManagement`),
    name: 'OrganizationManagement',
    meta: {
      title: '组织管理',
      bgColor: '#ffffff',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/organizationUser/role',
    component: loadComponent(`organizationUser/role`),
    name: 'SystemRoleList',
    meta: {
      title: '角色管理',
      activeMenu: '/system'
    }
  },
  // 供应商列表
  {
    path: 'system/organizationUser/supplier',
    component: loadComponent('organizationUser/supplier'),
    name: 'Supplier',
    meta: {
      title: '供应商管理',
      activeMenu: '/system',
      keepAlive: true
    }
  },
  // 供应商列表 ->用户管理
  {
    path: 'system/organizationUser/supplier/userList',
    component: loadComponent('organizationUser/supplier/user'),
    name: 'UserList',
    meta: {
      title: '管理用户',
      selectKeysPath: '/system/organizationUser/supplier',
      breadcrumb: [
        {
          name: '供应商列表',
          path: '/system/organizationUser/supplier'
        },
        {
          name: '管理用户',
          path: false
        }
      ],
      activeMenu: '/system',
      keepAliveParentName: ['Supplier']
    }
  },
  // 系统日志
  {
    path: 'system/systemLog/loginLog',
    component: loadComponent(`systemLog/loginLog`),
    name: 'LoginLog',
    meta: {
      title: '登录日志',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/systemLog/operationLog',
    component: loadComponent(`systemLog/operationLog`),
    name: 'OperationLog',
    meta: {
      title: '操作日志',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/systemLog/noticeLog',
    component: loadComponent(`systemLog/noticeLog`),
    name: 'NoticeLog',
    meta: {
      title: '消息日志',
      activeMenu: '/system'
    }
  },
  // 信息发布
  {
    path: 'system/information/notice',
    component: loadComponent(`information/notice`),
    name: 'Notice',
    meta: {
      title: '系统公告',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/information/policy',
    component: loadComponent(`information/notice`),
    name: 'Policy',
    meta: {
      title: '相关政策',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/information/institution',
    component: loadComponent(`information/notice`),
    name: 'Institution',
    meta: {
      title: '管理制度',
      activeMenu: '/system'
    }
  },
  {
    path: 'system/dataDict',
    component: loadComponent(`dataDict`),
    name: 'SystemDataDict',
    meta: {
      title: '数据字典',
      activeMenu: '/system'
    }
  }
]

export default routes
